package com.prj.ufdm.cloud.ms.core.bpo._impl.code;

import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.prj.ufdm.cloud.ms.core.bpo._impl.BaseBPOImpl;
import com.prj.ufdm.cloud.ms.core.bpo.code.SysCodeItemBPO;
import com.prj.ufdm.cloud.ms.core.dao.code.SysCodeItemDao;
import com.prj.ufdm.cloud.ms.core.model.code.SysCodeItem;


/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhengzixiang
 * @since 2019-09-20
 */
@Service(value="sysCodeItemBPO")
public class SysCodeItemBPOImpl extends BaseBPOImpl<SysCodeItemDao, SysCodeItem>  implements SysCodeItemBPO {

    @Autowired
    private  SysCodeItemDao sysCodeItemDao;

	@Override
	public Integer doGetTotalBysysCodeIds(String sysCodeIds) throws Exception {
		if (sysCodeIds == null)  sysCodeIds="";
		String[] arrParamId = sysCodeIds.split(",");
		List<String> idList = new ArrayList<String>();
		for(String paramId : arrParamId){
			idList.add(paramId);
		}
		return sysCodeItemDao.selectTotalBySysCodeIds(idList);
	}

	@Override
	public Integer doGetNotMeTotal(SysCodeItem codeItem) throws Exception {
		return sysCodeItemDao.selectNotMeTotal(codeItem);
	}

	@Override
	public Integer doGetMaxOrdinalBySysCodeId(String codeId) throws Exception {
		Integer max=sysCodeItemDao.selectMaxOrdinalBySysCodeId(codeId);
		if(null==max) {
			return 0;
		}
		return max;
	}

	@Override
	public List<SysCodeItem> doGetEnumListByCodeAndEnabledState(String code, String enabledState) throws Exception {
		if(StringUtils.isNotBlank(code)) {
			return sysCodeItemDao.selectBySysCodeAndEnabledState(code, enabledState);
		}
		return null;
	}


   
}
